package com.wu.service.impl;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wu.mapper.FriendLinkMapper;
import com.wu.pojo.FriendLink;
import com.wu.service.FriendLinkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: 吴磊
 * @program: blog
 * @create: 2021-04-27 19:02
 */
@Service
public class FriendLinkServiceImpl extends ServiceImpl<FriendLinkMapper, FriendLink> implements FriendLinkService {

    @Autowired
    private FriendLinkMapper friendLinkMapper;

    @Override
    public List<FriendLink> getAllFriendLink() {
        return friendLinkMapper.getAllFriendLink();
    }

    @Override
    public void addFriendLink(String linkName, String linkAddress) {
        String uuid = IdWorker.get32UUID();
        FriendLink friendLink = new FriendLink();
        friendLink.setLinkId(uuid);
        friendLink.setLinkName(linkName);
        friendLink.setLinkAddress(linkAddress);
        friendLinkMapper.insertLink(friendLink);
    }
}
